<template>
  <div class="content-container">
    <!-- 快捷入口图标区 -->
    <div class="quick-entry">
      <div class="entry-item" v-for="(item, index) in menuItems" :key="index" @click="goToNewProducts">
        <div class="icon-box">{{ item.icon }}</div>
        <span>{{ item.title }}</span>
      </div>
    </div>

    <!-- 众筹区域 -->
    <div class="crowdfunding-section">
      <div class="section-header">
        <h2 class="title">小米有品众筹</h2>
        <span class="subtitle">永远好奇 永远年轻</span>
        <a class="more" href="#">更多 ></a>
      </div>
      
      <div class="product-card" @click="goToDetail">
        <div class="product-info">
          <h3>按摩电动功能沙发</h3>
          <p>高配左右双躺头+双座电动调节...</p>
          <div class="price">¥ 3999<span class="unit">起</span></div>
        </div>
        <div class="product-image">
          <img src="@/assets/images/23.png" alt="按摩电动功能沙发">
          <div class="image-label">沙发展示</div>
        </div>
        <div class="progress-info">
          <div class="left-info">
            <span class="supporters">240 人支持</span>
            <span class="hot-tag">热</span>
          </div>
          <span class="percentage">283%</span>
        </div>
      </div>
    </div>

    <!-- 秒杀区域 -->
    <div class="flash-sale-section">
      <div class="section-header">
        <h2 class="title">有品秒杀</h2>
        <div class="countdown">
          <span>12:00场</span>
          <span class="timer">23:33:33</span>
        </div>
        <a class="more" href="#">更多 ></a>
      </div>
      
      <div class="product-card">
        <img src="@/assets/images/21.png" alt="无雾加湿器暖器">
        <div class="product-info">
          <h3>无雾加湿器暖器</h3>
          <div class="price">
            <span class="current">¥459</span>
            <span class="original">¥699</span>
          </div>
        </div>
      </div>
    </div>

    <!-- 每日新品 -->
    <div class="new-products-section">
      <div class="section-header">
        <h2 class="title">每日新品</h2>
        <span class="subtitle">每天10:00 惊喜不断</span>
        <a class="more" href="#">更多 ></a>
      </div>
      
      <div class="product-card">
        <img src="@/assets/images/22.png" alt="舒适颈椎按摩枕">
        <div class="product-info">
          <h3>舒适颈椎按摩枕</h3>
          <p>颈椎按摩多功能按摩枕</p>
          <div class="price">6699<span class="unit">起</span></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      menuItems: [
        { title: '上新精选', icon: 'NEW' },
        { title: '小米众筹', icon: '众' },
        { title: '有品秒杀', icon: '秒' },
        { title: '生活优选', icon: '优' },
        { title: '小米自营', icon: '米' }
      ]
    }
  },
  methods: {
    goToDetail() {
      this.$router.push('/product/detail')
    },
    goToNewProducts() {
      this.$router.push('/new-products')
    }
  }
}
</script>

<style scoped>
.content-container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 15px;
}

.quick-entry {
  display: flex;
  justify-content: space-around;
  margin-bottom: 30px;
}

.entry-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.icon-box {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #826c5b;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 14px;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.title {
  font-size: 22px;
  margin-right: 15px;
}

.subtitle {
  color: #999;
  font-size: 14px;
}

.more {
  margin-left: auto;
  color: #999;
  text-decoration: none;
}

.product-card {
  background: #fafafa;
  padding: 20px;
  border-radius: 8px;
  cursor: pointer;
}

.product-info h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
}

.product-info p {
  color: #666;
  margin: 0 0 15px 0;
}

.price {
  color: #ff6700;
  font-size: 24px;
}

.unit {
  font-size: 14px;
}

.product-placeholder {
  height: 200px;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 15px 0;
  color: #666;
  border-radius: 4px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  color: #666;
  font-size: 14px;
}

.percentage {
  color: #ff6700;
}

@media (max-width: 768px) {
  .quick-entry {
    flex-wrap: wrap;
    gap: 20px;
  }
  
  .entry-item {
    width: 33%;
  }
}

@media (max-width: 480px) {
  .entry-item {
    width: 50%;
  }
}

.flash-sale-section,
.new-products-section {
  margin-top: 30px;
}

.countdown {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 20px;
}

.timer {
  background: #ff6700;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
}

.product-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.product-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-info {
  padding: 15px;
}

.product-info h3 {
  margin: 0;
  font-size: 16px;
  color: #333;
}

.product-info p {
  margin: 5px 0;
  color: #666;
  font-size: 14px;
}

.price {
  margin-top: 10px;
}

.current {
  color: #ff6700;
  font-size: 20px;
  font-weight: bold;
}

.original {
  color: #999;
  font-size: 14px;
  text-decoration: line-through;
  margin-left: 10px;
}

.unit {
  font-size: 14px;
  margin-left: 2px;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .product-card img {
    height: 150px;
  }
}

.product-image {
  position: relative;
  width: 100%;
  height: 300px;
  margin: 15px 0;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-label {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
}

.left-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.supporters {
  color: #666;
}

.hot-tag {
  background: #ff6700;
  color: white;
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 12px;
}

.percentage {
  color: #ff6700;
  font-weight: bold;
}

.price {
  color: #ff6700;
  font-size: 24px;
  font-weight: bold;
}

.unit {
  font-size: 14px;
  margin-left: 2px;
}

.product-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
</style> 